<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册页面</title>
</head>
<body>
<form>
    <input name="name" type="text" id="name" /><br>
    <input name="pwd" type="password" id="pwd" /><br>
    <input type="button" value="注册" onclick="register()"/>
</form>
</body>
<script>
    function register() {
        let username = document.getElementById("name").value;
        let password = document.getElementById("pwd").value;
        let data = {
            username:username,
            password:password
        }
        let ajax = new XMLHttpRequest();
        ajax.open("post", "/sysuser/register");
        ajax.setRequestHeader("Content-type", "application/json;charset=utf-8");
        ajax.setRequestHeader("token",localStorage.getItem("token"));
        ajax.send(JSON.stringify(data));
        ajax.onreadystatechange = () => {
            console.log(ajax.responseText);

        }
    }
</script>
</html>